import baseUrl from './baseUrl.js'

export const addRoleApply = data =>{
	return new Promise((res, rej)=>{
		uni.request({
			url: baseUrl + '/roleApply/addRoleApply',
			method:'POST',
			header:{
				'token': uni.getStorageSync('token'),
				'Content-type': 'application/x-www-form-urlencoded'
			},
			data,
			success(response) {
				res(response)
			},
			fail(err) {
				rej(err)
				uni.showToast({
					title:'数据获取失败',
					icon:'error'
				})
			}
		})
	})
}

export const getRoleApply = () =>{
	return new Promise((res, rej)=>{
		uni.request({
			url: baseUrl + '/roleApply/getRoleApply',
			method:'POST',
			header:{
				'token': uni.getStorageSync('token'),
				'Content-type': 'application/x-www-form-urlencoded'
			},
			data:{},
			success(response) {
				res(response)
			},
			fail(err) {
				rej(err)
				uni.showToast({
					title:'数据获取失败',
					icon:'error'
				})
			}
		})
	})
}

export const updRoleApply = data =>{
	return new Promise((res, rej)=>{
		uni.request({
			url: baseUrl + '/roleApply/updRoleApply',
			method:'POST',
			header:{
				'token': uni.getStorageSync('token'),
				'Content-type': 'application/x-www-form-urlencoded'
			},
			data,
			success(response) {
				res(response)
			},
			fail(err) {
				rej(err)
				uni.showToast({
					title:'数据获取失败',
					icon:'error'
				})
			}
		})
	})
}